package koction.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class AdminLoginCheckInterceptor extends HandlerInterceptorAdapter{

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		HttpSession session=request.getSession(false);
		//비로그인 상태의 클라이언트
		
		if(session==null||session.getAttribute("avo")==null){
			System.out.println("Admin Interceptor 회원 비로그인 상태");
			response.sendRedirect("admin_login.do");
			return false; // 실행중단 
		}
		return true; // true로 반환하면 다음단계(컨트롤러 메서드)수행
	}
	
}
